﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms.Design;
namespace Students.Sandcastle.PropertyEditor
{
    class PlugInConfigurationsEditor : UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(
            System.ComponentModel.ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }


        public IWindowsFormsEditorService editorService;


        public override object EditValue(
    ITypeDescriptorContext context,
    IServiceProvider provider,
    object value)
        {
            if (provider != null)
            {
                editorService =
                    provider.GetService(
                    typeof(IWindowsFormsEditorService))
                    as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                PlugInConfigurations pluginDialog = new PlugInConfigurations();
                editorService.ShowDialog(pluginDialog);

                value = String.Format("Количество плагинов {0}", pluginDialog.numberPlagin);//;
            }

            return value;
        }


        // This method indicates to the design environment that
        // the type editor will paint additional content in the
        // LightShape entry in the PropertyGrid.
        public override bool GetPaintValueSupported(
            ITypeDescriptorContext context)
        {
            return false;
        }

        // This method paints a graphical representation of the 
        // selected value of the LightShpae property.
        public override void PaintValue(PaintValueEventArgs e)
        {
          
        }
    }
}
